package ppms.ui.edtor;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;

import ppms.commons.data.entity.IDataEntity;

public class PropertyEditor extends EditorPart
{

    public static final String ID = "ppms.ui.edtor.PropertyEditor"; //$NON-NLS-1$

    private IDataEntity data = null;
    
    /**
     * Create contents of the editor part
     * @param parent
     */
    @Override
    public void createPartControl(Composite parent)
    {
	Composite container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(1,false));
	
	final Label label = new Label(container, SWT.NONE);
	label.setText(this.data.getValue());
	label.setBounds(42, 46, 25, 13);
	
    }

    @Override
    public void setFocus()
    {
	// Set the focus
    }

    @Override
    public void doSave(IProgressMonitor monitor)
    {
	// Do the Save operation
    }

    @Override
    public void doSaveAs()
    {
	// Do the Save As operation
    }

    @Override
    public void init(IEditorSite site, IEditorInput input) throws PartInitException
    {
	// Initialize the editor part
	
	this.data = ((PropertyEditorInput)input).getData();
	
	this.setSite(site);
	this.setInput(input);
	
	
    }

    @Override
    public boolean isDirty()
    {
	return false;
    }

    @Override
    public boolean isSaveAsAllowed()
    {
	return false;
    }

}
